﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ARS.Control.Custom.Entity.Forms
{
    /// <summary>
    /// 验证控件
    /// </summary>
    public class CharValidateForm:CharForm
    {
        public CharValidateForm()
        {

        }
        public CharValidateForm(string reg,string tip)
        {
            this._reg = reg;
            this._tip = tip;
        }
        private string _reg;
        protected virtual string GetValidateReg()
        {
            return this._reg;
        }

        private string _tip;
        protected virtual string GetValidateTip()
        {
            return this._tip;
        }

        protected override void RenderContents(System.Web.UI.HtmlTextWriter output)
        {
            //base.RenderContents(output);
            if (base.Field is Fields.CharValidateField)
            {
                Fields.CharValidateField field = base.Field as Fields.CharValidateField;
                this._reg = field.RegexStr;
                this._tip = field.Tip;
            }
            else
            {

            }
            string html = string.Format(this.GetInputTextHtml(),
                string.Format("reg=\"{0}\" tip=\"{1}\" IsAllowBlank={2}", this.GetValidateReg(), this.GetValidateTip(),
                    Field.IsAllowBlank));
            output.Write(html);
        }
    }
}
